#!/bin/bash

LOC=`dirname "$0"`
SUM=0

for A in ${LOC}/../*.xml; do
    xmllint --noout --schema ${LOC}/../schema/zcl.xsd  $A
    SUM=$(( $SUM + $?))
done

for A in ${LOC}/../../silabs/*.xml; do
    xmllint --noout --schema ${LOC}/../schema/zcl.xsd  $A
    SUM=$(( $SUM + $?))
done

for A in ${LOC}/../../matter/*.xml; do
    xmllint --noout --schema ${LOC}/../schema/zcl.xsd  $A
    echo "** WARNING: Ignoring Matter validation errors. **"
    #SUM=$(( $SUM + $?))
done

for A in ${LOC}/../../../test/resource/meta/*.xml; do
    xmllint --noout --schema ${LOC}/../schema/zcl.xsd  $A
    SUM=$(( $SUM + $?))
done

for A in ${LOC}/../../../test/resource/custom-cluster/[!b]*.xml; do
    xmllint --noout --schema ${LOC}/../schema/zcl.xsd  $A
    SUM=$(( $SUM + $?))
done

exit $SUM
